package day05;

import java.util.Scanner;

public class Abbition {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum = 0;//和
        int difference = 0;//差
        int minute = 0;//分数
        System.out.println("开始作答");
        for (int i = 1; i <= 10; i++) {
            int num1 = (int) (Math.random()*101);
            int num2 = (int) (Math.random()*101);
            int judge = (int) (Math.random()*2);
            if (judge==0) {
                sum = num1 + num2;
                System.out.println("（" + i + ")" + num1 + "+" + num2 + "=");
                int answer = sc.nextInt();
                if (answer == sum) {
                    System.out.println("答对了");
                    minute += 10;
                } else {
                    System.out.println("答错了");
                }
            }else {
                difference = num1-num2;
                System.out.println("（" + i + ")" + num1 + "-" + num2 + "=");
                int answer2 = sc.nextInt();
                if (answer2 == difference) {
                    System.out.println("答对了");
                    minute += 10;
                } else {
                    System.out.println("答错了");
                }

            }

        }
        System.out.println(minute);
    }
}
